Skip to content

studio: URL routing, grid padding fix, and de-jargoned copy#7

Merged
softmarshmallow merged 4 commits into
mainfrom
feat/studio-routing-grid-copy
Jul 13, 2026
Merged

studio: URL routing, grid padding fix, and de-jargoned copy#7
softmarshmallow merged 4 commits into
mainfrom
feat/studio-routing-grid-copy

Conversation

@softmarshmallow

Copy link
Copy Markdown
Member

Three studio improvements, one per commit.

1. URL-based page routing (feat)

The view lived purely in React state, so a browser reload always dropped you back on the Overview. The current view is now part of the URL via the History API (not a # hash), so a hard reload or a shared deep link restores it.

  • lib/router.tsRoute ↔ pathname mapping under the /~studio base (/~studio/table/user, /~studio/fn/create_post, /~studio/storage, …)
  • app.tsx — initial view read from window.location; navigate() does pushState; a popstate listener mirrors back/forward into the view
  • http.rs — matching SPA history fallback: any /~studio/* path that isn't an embedded asset serves index.html; a path whose last segment has a file extension stays a genuine 404 (so a broken script/style src fails loudly instead of silently loading HTML)
  • new test studio_deep_link_falls_back_to_the_shell; README gets a Routing section

The impersonated Actor is intentionally kept out of the URL — it's a session toggle, so a reload restores the view but resets to anonymous.

2. Restore react-data-grid cell padding (fix)

RDG 7 wraps all its styles in @layer rdg. Because it was imported before Tailwind (in main.tsx), the rdg layer registered first = lowest priority, so Tailwind v4 Preflight's * { padding: 0 } (in the base layer) flattened every cell — columns ran together with no inset. Fix: import RDG's stylesheet from index.css after Tailwind, so @layer rdg sorts after base and RDG's padding-inline: 8px wins. Our unlayered .rdg{…} token overrides still beat everything.

3. De-jargon user-facing copy (refactor)

Internal design doctrine had leaked into rendered strings — "the floor", "provenance, not governance", "predicate IR / PostgREST dialect", RFD numbers, "the seam is preparatory, not protective, until v1 policy", "exposure surface", etc. Rewrote the 16 leaked strings across overview/table-view/fn-runner/storage-view/err-codes to plain language, keeping real identifiers a developer needs (/rest/v1/… endpoints, = me, spock_actor(), storage_object, spock_refuse()). Code comments (which don't render) are left as-is.

Verification

  • tsc + oxlint clean; cargo test -p spock-runtime --test http studio (3 pass, incl. the new deep-link test); clippy + fmt green
  • Verified live against examples/instagram/v0.spock: reload/deep-link/back-forward restore the correct view; grid cells now have proper 8px padding (dark mode intact); all five surfaces read in plain language; zero console errors

Reviewer notes

  • studio/dist/ is gitignored (built, not committed) — reviewers need pnpm build in crates/spock-runtime/studio then cargo build to see it in the binary, per the studio README
  • No behavior change to the runtime data plane; all changes are the studio SPA + its static-asset serving

The view lived purely in React state, so a browser reload always reset to
the Overview. Make the current view part of the URL (real History API, not a
hash) so a reload or shared deep link restores it.

- lib/router.ts: Route <-> pathname mapping under the /~studio base
- app.tsx: init from window.location, pushState on navigate, popstate listener
- http.rs: SPA history fallback — serve index.html for any /~studio/* path
  that isn't an embedded asset; paths with a file extension stay a genuine 404
- tests: studio_deep_link_falls_back_to_the_shell
- README: Routing section
RDG 7 wraps its styles in `@layer rdg`; imported before Tailwind (in main.tsx)
it registered first = lowest priority, so Tailwind v4 Preflight's
`*{padding:0}` (in `base`) flattened every cell.

Import RDG's stylesheet from index.css *after* Tailwind, so `@layer rdg`
registers after `base` and RDG's cell padding wins. Our unlayered `.rdg{}`
token overrides still beat everything.
Internal design doctrine had leaked into rendered strings — 'the floor',
'provenance, not governance', 'predicate IR', RFD numbers, 'the seam is
preparatory, not protective', etc. Rewrite the 16 leaked strings to plain
language, keeping real identifiers a developer needs (/rest/v1 endpoints,
= me, spock_actor(), storage_object, spock_refuse()). Code comments, which
don't render, are left as-is.
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@softmarshmallow, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 48 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8650243b-c22a-4c0e-85db-daf90290c61c

📥 Commits

Reviewing files that changed from the base of the PR and between 0e958c1 and 9e7712a.

📒 Files selected for processing (2)
  • crates/spock-runtime/studio/src/app.tsx
  • crates/spock-runtime/studio/src/lib/router.ts

Walkthrough

Studio navigation now synchronizes routes with browser URLs, supports deep-link restoration through server-side SPA fallback, and adds coverage for that behavior. Studio copy, refusal labels, and React Data Grid stylesheet ordering were also updated.

Changes

Studio SPA routing

Layer / File(s) Summary
Route mapping contract
crates/spock-runtime/studio/src/lib/router.ts
Added route-to-path, path-to-route, normalized path comparison, and route-title helpers.
Application URL synchronization
crates/spock-runtime/studio/src/app.tsx
Initial routes, navigation, browser history, document titles, and popstate now remain synchronized.
Server shell fallback and validation
crates/spock-runtime/src/http.rs, crates/spock-runtime/tests/http.rs, crates/spock-runtime/studio/README.md
Missing extension paths serve the SPA shell, asset-like paths remain 404s, and deep-link behavior is tested and documented.

Studio presentation updates

Layer / File(s) Summary
Presentation copy and stylesheet loading
crates/spock-runtime/studio/src/components/err-codes.tsx, crates/spock-runtime/studio/src/index.css, crates/spock-runtime/studio/src/main.tsx, crates/spock-runtime/studio/src/views/*
Updated Studio labels and explanatory text, revised refusal tooltips, and centralized React Data Grid stylesheet ordering.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Browser
  participant App
  participant Router
  participant Server
  Browser->>Server: Request /~studio/deep-link
  Server-->>Browser: SPA index.html
  Browser->>App: Load current pathname
  App->>Router: pathToRoute(pathname)
  Router-->>App: Selected Route
  App->>Browser: pushState and update title
  Browser-->>App: popstate on back/forward
  App->>Router: pathToRoute(current pathname)
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the three main Studio changes in the pull request.
Description check ✅ Passed The description matches the changeset and accurately describes the routing, styling, and copy updates.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/studio-routing-grid-copy

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/spock-runtime/studio/src/lib/router.ts`:
- Around line 65-66: Update the "record" case in the route-name switch so a
missing name returns the "records" route, matching the existing table and fn
fallbacks; preserve the named-record route behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2324dbd4-f252-40a0-a23e-47a0425229d7

📥 Commits

Reviewing files that changed from the base of the PR and between 142f16b and 0e958c1.

📒 Files selected for processing (12)
  • crates/spock-runtime/src/http.rs
  • crates/spock-runtime/studio/README.md
  • crates/spock-runtime/studio/src/app.tsx
  • crates/spock-runtime/studio/src/components/err-codes.tsx
  • crates/spock-runtime/studio/src/index.css
  • crates/spock-runtime/studio/src/lib/router.ts
  • crates/spock-runtime/studio/src/main.tsx
  • crates/spock-runtime/studio/src/views/fn-runner.tsx
  • crates/spock-runtime/studio/src/views/overview.tsx
  • crates/spock-runtime/studio/src/views/storage-view.tsx
  • crates/spock-runtime/studio/src/views/table-view.tsx
  • crates/spock-runtime/tests/http.rs

Comment thread crates/spock-runtime/studio/src/lib/router.ts Outdated
CodeRabbit: a nameless `record` fell back to `overview` while `table`->`tables`
and `fn`->`fns`. Make it consistent (`record` no-name -> `records`), and give
the `records` kind a view: renderView now falls back to the home summary for
records-level paths (records have per-record pages but no dedicated overview),
which also fixes the previously-blank `/~studio/records`.
@softmarshmallow softmarshmallow merged commit 4b871a9 into main Jul 13, 2026
2 checks passed
@softmarshmallow softmarshmallow deleted the feat/studio-routing-grid-copy branch July 13, 2026 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant